From: Keir Fraser Date: Tue, 8 Jan 2008 10:13:11 +0000 (+0000) Subject: x86: Fixes for S3 suspend resume: X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14445^2~70 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d3f057861094611207862770fac4dcc6a140dd1e;p=xen.git x86: Fixes for S3 suspend resume: - Fix wallclock resume by remembering the offset from CMOS time to UTC time - Restore dom0's CPU affinity (lost during continue_hypercall_on_cpu()) Signed-off-by: Xu Dongxiao --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 588a7fb1f7..957e33ef57 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1420,6 +1420,7 @@ static void continue_hypercall_on_cpu_helper(struct vcpu *v) regs->eax = info->func(info->data); v->arch.schedule_tail = info->saved_schedule_tail; + v->cpu_affinity = info->saved_affinity; v->arch.continue_info = NULL; xfree(info); diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index a9e2b5b735..6d4946245b 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -971,8 +971,14 @@ unsigned long get_localtime(struct domain *d) + d->time_offset_seconds; } +/* "cmos_utc_offset" is the difference between UTC time and CMOS time. */ +static long cmos_utc_offset; /* in seconds */ + int time_suspend(void) { + cmos_utc_offset = (wc_sec + (wc_nsec + NOW()) / 1000000000ULL) + - get_cmos_time(); + /* Better to cancel calibration timer for accuracy. */ kill_timer(&this_cpu(cpu_time).calibration_timer); @@ -986,7 +992,8 @@ int time_resume(void) set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp); resume_platform_timer(); - do_settime(get_cmos_time(), 0, read_platform_stime()); + + do_settime(get_cmos_time() + cmos_utc_offset, 0, read_platform_stime()); init_percpu_time();